
// src/api/nongjt/certificate/certificate.js
import request from '@/utils/request'

// 查询合格证列表
export function listCertificate(query) {
  return request({
    url: '/nongjt/certificate/list',
    method: 'get',
    params: query
  })
}

// 查询合格证明细
export function getCertificate(id) {
  return request({
    url: '/nongjt/certificate/' + id,
    method: 'get'
  })
}

// 新增合格证
export function addCertificate(data) {
  return request({
    url: '/nongjt/certificate/add',
    method: 'post',
    data: data
  })
}

// 修改合格证
export function updateCertificate(data) {
  return request({
    url: '/nongjt/certificate/update',
    method: 'put',
    data: data
  })
}

// 删除合格证
export function delCertificate(id) {
  if (Array.isArray(id)) {
    return request({
      url: '/nongjt/certificate/deleteBatch',
      method: 'delete',
      data: id
    })
  } else {
    return request({
      url: '/nongjt/certificate/' + id,
      method: 'delete'
    })
  }
}

// 导出合格证
export function exportCertificate(query) {
  return request({
    url: '/nongjt/certificate/export',
    method: 'get',
    params: query
  })
}
